from django.contrib import admin
from . import models


# Register your models here.
# 将Book类注册为可管理页面
# admin.site.register(models.Book)


class BookManager(admin.ModelAdmin):
    list_display = ['id', 'title', 'price', 'market_price', 'pub_date', 'pub_house']
    list_display_links = ['id', 'title']
    list_filter = ['pub_house']
    search_fields = ['title']
    list_editable = ['price', 'market_price']


# 注册models.Book模型类与管理器类BookManager关联
admin.site.register(models.Book, BookManager)


class AuthorManager(admin.ModelAdmin):
    list_display = ['id', 'name', 'age']
    list_display_links = ['id', 'name']


admin.site.register(models.Author, AuthorManager)
admin.site.register(models.Wife)
admin.site.register(models.Publisher)
